<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@include file="common/header.jsp" %>
<div class="row">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <div class="x_panel">
            <div class="x_title">
                <h2>APP信息管理维护 <small><i class="fa fa-user"></i>${userSession.devName}您可以通过搜索或者其他的筛选项对APP的信息进行修改、删除等管理操作。</small>
                </h2>
                <div class="clearfix"></div>
            </div>
            <div class="x_content">
                <br/>
                <form id="demo-form2" data-parsley-validate
                      class="form-horizontal form-label-left">
                    <input type="hidden" name="pageIndex" value="1"/>
                    <ul>
                        <li>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">软件名称：
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="_softwareName" name="_softwareName" value="${softwareName}"
                                           class="form-control col-md-7 col-xs-12">
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="last-name">APP状态
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <select name="_status" class="form-control">
                                        <c:if test="${statusList!=null}">
                                            <option  value="">---请选择---</option>
                                            <c:forEach items="${statusList}" var="data">
                                                <option
                                                        <c:if test="${data.valueId==status}">selected="selected"</c:if>
                                                        value="${data.valueId}">${data.valueName}</option>
                                            </c:forEach>
                                        </c:if>
                                    </select>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="last-name">所属平台
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <select name="_flatformId" class="form-control">
                                        <c:if test="${flatformList!=null}">
                                            <option value="">---请选择---</option>
                                            <c:forEach items="${flatformList}" var="data">
                                                <option
                                                        <c:if test="${data.valueId==flatformId}">selected="selected"</c:if>
                                                        value="${data.valueId}">${data.valueName}</option>
                                            </c:forEach>
                                        </c:if>
                                    </select>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="last-name">一级分类
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <select name="_categoryLevel1" id="_categoryLevel1" class="form-control">
                                        <c:if test="${categoryLevel1List!=null}">
                                            <option value="">---请选择---</option>
                                            <c:forEach items="${categoryLevel1List}" var="appCategory">
                                                <option
                                                        <c:if test="${appCategory.id==categoryLevel1}">selected="selected"</c:if>
                                                        value="${appCategory.id}">${appCategory.categoryName}</option>
                                            </c:forEach>
                                        </c:if>
                                    </select>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="last-name">二级分类
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <select name="_categoryLevel2" id="_categoryLevel2" class="form-control">
                                        <c:if test="${categoryLevel2List!=null}">
                                            <option value="">---请选择---</option>
                                            <c:forEach items="${categoryLevel2List}" var="appCategory">
                                                <option
                                                        <c:if test="${appCategory.id==categoryLevel2}">selected="selected"</c:if>
                                                        value="${appCategory.id}">${appCategory.categoryName}</option>
                                            </c:forEach>
                                        </c:if>
                                    </select>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="last-name">三级分类
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <select name="_categoryLevel3" id="_categoryLevel3" class="form-control">
                                        <c:if test="${categoryLevel3List!=null}">
                                            <option value="">---请选择---</option>
                                            <c:forEach items="${categoryLevel3List}" var="appCategory">
                                                <option
                                                        <c:if test="${appCategory.id==categoryLevel3}">selected="selected"</c:if>
                                                        value="${appCategory.id}">${appCategory.categoryName}</option>
                                            </c:forEach>
                                        </c:if>
                                    </select>
                                </div>
                            </div>
                        </li>
                        <li>

                            <div class="form-group">
                                <button type="submit" class="btn btn-success">查询</button>
                            </div>
                        </li>
                    </ul>
                </form>
            </div>
        </div>
        <div class="x_panel">
            <div class="x_content">
                <a href="${pageContext.request.contextPath }/appInfo/appinfoadd" class="btn btn-success">新增APP基础信息</a>
                <table id="datatable" class="table table-striped table-bordered">
                    <thead>
                    <tr>
                        <th>软件名称</th>
                        <th>APK名称</th>
                        <th>软件大小（单位：M）</th>
                        <th>所属平台</th>
                        <th>所属分类（一级分类、二级分类、三年级分类）</th>
                        <th>状态</th>
                        <th>下载次数</th>
                        <th>最新版本号</th>
                        <th style="width: 124px">操作</th>
                    </tr>
                    </thead>

                    <tbody>
                    <c:forEach var="appInfo" items="${appInfolist}">
                        <tr>
                            <td>${appInfo.softwareName}</td>
                            <td>${appInfo.APKName}</td>
                            <td>${appInfo.softwareSize}</td>
                            <td>${appInfo.flatformName}</td>
                            <td>${appInfo.categoryLevel1Name}->${appInfo.categoryLevel2Name}->${appInfo.categoryLevel3Name}</td>
                            <td><span id="appInfoStatus${appInfo.id}">${appInfo.statusName}</span></td>
                            <td>${appInfo.downloads}</td>
                            <td>${appInfo.versionNo}</td>
                            <td>
                                <div class="btn-group">
                                    <button type="button" class="btn btn-danger">点击操作</button>
                                    <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown"
                                            aria-expanded="false">
                                        <span class="caret"></span>
                                        <span class="sr-only">Toggle Dropdown</span>
                                    </button>
                                    <ul class="dropdown-menu" role="menu">
                                        <li>
                                            <c:choose>
                                                <c:when test="${appInfo.status==2 || appInfo.status==5}">
                                                    <a class="saleSwichOpen" saleSwitch="open"
                                                       data-toggle="tooltip" title="" data-placement= "left"
                                                       appinfoid="${appInfo.id}"
                                                       softwarename="${appInfo.softwareName}"
                                                       data-original-title="恭喜您，您的审核已通过，您可以点击上架按钮发布您的APP">上架</a>
                                                </c:when>
                                                <c:when test="${appInfo.status==4 }">
                                                    <a class="saleSwichClose" saleSwitch="close"
                                                       data-toggle="tooltip" title="" data-placement= "left"
                                                       appinfoid="${appInfo.id}"
                                                       softwarename="${appInfo.softwareName}"
                                                       data-original-title="您可以点击下架停止您发布的APP，市场将不提供您的APP下载">下架</a>
                                                </c:when>
                                            </c:choose>
                                        </li>
                                        <li><a data-toggle="tooltip"
                                               data-placement= "left" title="" class="addVersion"
                                               appinfoid="${appInfo.id}"
                                               data-original-title="新增APP版本信息">新增版本</a></li>
                                        <li><a href="#" data-toggle="tooltip"
                                               data-placement= "left" title=""
                                               appinfoid="${appInfo.id}"
                                               versionid="${appInfo.versionId}"
                                               status="${appInfo.status}"
                                               statusName="${statusName}"
                                               class="modifyVersion"
                                               data-original-title="修改APP最新版本信息">修改版本</a></li>
                                        <li><a href="#" data-toggle="tooltip" appinfoid= "${ appInfo.id } "
                                               status="${appInfo.status}"
                                               statusName="${appInfo.statusName}"
                                               class="modifyAppInfo"
                                               data-placement= "left" title=""
                                               data-original-title="修改APP基础信息">修改</a></li>
                                        <li><a class="viewApp" data-toggle="tooltip"
                                               data-placement= "left" title=""
                                               appinfoid="${appInfo.id}"
                                               data-original-title="查看APP基础信息以及版本信息">查看</a></li>
                                        <li><a class="deleteApp" data-toggle="tooltip"
                                               data-placement= "left" title=""
                                               appinfoid="${appInfo.id}"
                                               softwarename="${appInfo.softwareName}"
                                               data-original-title="删除APP基础信息以及全部版本信息">删除</a></li>
                                    </ul>
                                </div>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
            <div class="row">
                <div class= "col-sm-5">
                    <div class= "dataTables_ info" id= "datatable-responsive_info"
                         role= "status" aria-live= "polite ">共${pages.totalCount }条语录
                        ${pages.currentPageNo }/${pages.totalPageCount }页</div>
                </div>
                <div class="col-sm-7">
                    <div class= "dataTables_paginate paging_simple_numbers"
                         id= "datatable-responsive_paginate ">
                        <ul class= "pagination">
                            <c:if test= "${pages.currentPageNo > 1}">
                                <li class= "paginate_button previous">
                                    <a href= "javascript:page_nav(document.forms[0],1);"
                                       aria-controls= "datatable-responsive" data-dt-idx= "0"
                                       tabindex="0">首页</a>
                                </li>
                                <li class= "paginate_button">
                                    <a href= "javascript:page_nav(document.forms[0],${pages.currentPageNo}-1);"
                                       aria-controls= "datatable-responsive" data-dt-idx= "1"
                                       tabindex="0">上一页</a>
                                </li>
                            </c:if>
                            <c:if test= "${pages.currentPageNo < pages.totalPageCount}">
                                <li class= "paginate_button previous">
                                    <a href= "javascript:page_nav(document.forms[0],${pages.currentPageNo}+1);"
                                       aria-controls= "datatable-responsive" data-dt-idx= "1"
                                       tabindex="0">下一页</a>
                                </li>
                                <li class= "paginate_button">
                                    <a href= "javascript:page_nav(document.forms[0],${pages.totalPageCount}+0);"
                                       aria-controls= "datatable-responsive" data-dt-idx= "7"
                                       tabindex="0">最后一页</a>
                                </li>
                            </c:if>


                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</div>
</div></div>
</div>
<%@include file="common/footer.jsp" %>
<script src= "${pageContext.request.contextPath }/statics/localjs/rollpage.js"></script>
<script src= "${pageContext.request.contextPath }/statics/localjs/appinfolist.js"></script>


